package com.fm.service;

/**
 * Created by Administrator on 2018/7/30 0030.
 */

import com.fm.entity.Equipment;
import com.fm.mapper.EquipmentMapper;
import org.springframework.data.domain.Example;
import org.springframework.stereotype.Service;

@Service
public class EquipmentService extends MBaseService<Equipment, Integer, EquipmentMapper>{

    public Equipment getEquipmentByName(String name) {
        Equipment equipment = new Equipment();
        equipment.setName(name);
        return getMyBatisDao().findOne(Example.of(equipment)).get();
    }

    public Equipment getEquipmentBySecretKey(String key) {
        Equipment equipment = new Equipment();
        equipment.setDeviceSecret(key);
        return getMyBatisDao().findOne(Example.of(equipment)).get();
    }
}
